﻿using System;
using UnityEngine;
using UnityEngine.EventSystems;
namespace LitTools
{
    /// <summary>
    /// 拖拽观察
    /// </summary>
    [DisallowMultipleComponent]
    public class DragObserver : MonoBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler
    {
        public event Action<PointerEventData> OnBeginDragAct;
        public event Action<PointerEventData> OnDragAct;
        public event Action<PointerEventData> OnEndDragAct;
        public void OnBeginDrag(PointerEventData eventData)
        {
            OnBeginDragAct?.Invoke(eventData);
        }

        public void OnDrag(PointerEventData eventData)
        {
            OnDragAct?.Invoke(eventData);
        }

        public void OnEndDrag(PointerEventData eventData)
        {
            OnEndDragAct?.Invoke(eventData);
        }
    }
}